<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/* I use the controller class to debug
 * Author Zijian Wang
 */

class Location extends CI_Controller 
{

	function insert_loca()  // return true/false
	{

		$latitude = $__POST['latitude'];
		$longtitude = $__POST['longtitude'];
		$loca_name = $__POST['loca_name'];

		$this->load->model('location_model');

		$data=$this->location_model->insert_location($l_id,$kilometer,$start,$end);
		
		var_dump($data);

	}


	function locati_info()  // a list
	{
		$l_id = $__POST['l_id'];
		$this->load->model('location_model');
		$data =$this->location_model->get_location_info($l_id);
		
		var_dump($data);

	}


	function locati_near()  // a list
	{
		$l_id = $__POST['l_id'];	
		$kilometer = $__POST['kilometer'];
		$start = $__POST['start'];
		$end = $__POST['end'];

		$this->load->model('location_model');

		$data=$this->location_model->get_location_near($l_id,$kilometer,$start,$end);
		
		var_dump($data);

	}


	function search_loca()  // a list
	{

		$location_name = $__POST['location_name'];
		$start = $__POST['start'];
		$end = $__POST['end'];

		$this->load->model('location_model');

		$data=$this->location_model->get_location_near($l_id,$kilometer,$start,$end);
		
		var_dump($data);

	}

	function loca_co_near()  // a list
	{

		$latitude = $__POST['latitude'];
		$longtitude = $__POST['longtitude'];
		$kilometer = $__POST['kilometer'];

		$start = $__POST['start'];
		$end = $__POST['end'];

		$this->load->model('location_model');

		$data=$this->location_model->location_coordinate_near($latitude,$longtitude,$kilometer,$start,$end);
		
		var_dump($data);

	}
}

?>